﻿using CProcess.Services;

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

namespace CProcess
{
    class Program
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        static void Main(string[] args)
        {
            var s = new Settings("CProcess");
            var serviceName = s.GetValue("ServiceName");
            var source = s.GetValue("Source");
            var destination = s.GetValue("Destination");

            log.Info("CProcess has started...");

            WindowsServices.Stop(serviceName);
            BackupPlan.Run(source, destination);
            WindowsServices.Start(serviceName);

            log.Info("CProcess has finished!");               
        }
    }
}
